package cn.jsj.finance.bank;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.jsj.pojo.TblCashCheque;
import cn.jsj.utils.SysLogger;

/**
 * 加载所有现金支票信息处理类
 * @author LI
 *
 */
 public class ChequeInfoRequest extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 	// 调试信息
		 	cn.jsj.utils.SysLogger.PrintInfo("加载所有的现金支票信息！！！");

		 	//获得参数：1.第几条开始。2.一页显示几条
			int startNumb=Integer.parseInt(request.getParameter("start"));
			int totalNumb=Integer.parseInt(request.getParameter("limit"));

			//调试信息
			cn.jsj.utils.SysLogger.PrintInfo("start---->"+startNumb+"   total--------->"+totalNumb);

			//获得现金支票信息总条数
			cn.jsj.dao.TblCashChequeDAO tccd=new cn.jsj.dao.TblCashChequeDAO();
			int chequeNumber=tccd.getCashChequeNumb();
			//银行帐信息列表
			java.util.List<TblCashCheque> chequeList=new java.util.LinkedList<TblCashCheque>();
			chequeList=tccd.getCashCheque(startNumb, totalNumb);

			//转换成JSON型数据
			cn.jsj.utils.ProduceJsonData pjd=new cn.jsj.utils.ProduceJsonData();
			String jsonData=pjd.jsonFromList(chequeList, chequeNumber);

			//调试信息
			SysLogger.PrintInfo(jsonData);
			//输出到客户端
			java.io.PrintWriter pw=response.getWriter();
			pw.println(jsonData);
			pw.flush();
			pw.close();
	}
}